package com.util;

/**
 * 分页面
 *
 * @author wang_
 * @version 2024.3.4.1
 * @description
 * @date 2025/6/30
 */
public class Page {
	private int pageSize; // 每页显示的条数
	private int pageNo; // 当前页码
	private int totalPage; // 总页数
	private int totalCount; // 总条数
	
	public int getPageSize() {
		return pageSize;
	}
	
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	
	public int getPageNo() {
		return pageNo;
	}
	
	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}
	
	public int getTotalPage() {
		return totalPage;
	}
	
	/**
	 * 设置总页数
	 *
	 * @param totalCount 总条数
	 */
	public void setTotalPage(int totalCount) {
		if (totalCount > 0) {
			this.totalCount = totalCount;
			if (pageSize == 0) {
				pageSize = 1;
			}
			if (this.totalCount % pageSize == 0) {
				this.totalPage = totalCount / pageSize;
			} else {
				this.totalPage = totalCount / pageSize + 1;
			}
		}
	}
	
	public int getTotalCount() {
		return totalCount;
	}
	
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}
}
